// Menubutton
// Creates a menu button that checks the position of the mouse cursor and 
// returns whether or not the cursor is hovering over the graphic.
// Can then use this information to change the state of the button
// i.e. is it highlighted or not.

#pragma once

#include <d3d9.h>
#include <d3dx9.h>

class MenuButton
{
private:
	//D3DXVECTOR3			mScreenPosition;
	D3DXVECTOR3			mCenter;
	ID3DXFont*			mFont;
	ID3DXSprite*		mSprite;
	IDirect3DTexture9*	mTextureLit;
	IDirect3DTexture9*	mTextureUnlit;
	HWND				mWnd;
	bool				mIsPressed;
	LPCSTR				mText;
	bool				mPlaySound;

	float				screenX;
	float				screenY;

	float				xf;
	float				yf;

	UINT				idNum;

public:
	MenuButton(UINT id, float xFrac, float yFrac,
		float bbWidth, float bbHeight,
		int h, 
		int w, 
		LPCSTR texLit, 
		LPCSTR texUnlit, 
		LPCSTR text, 
		ID3DXSprite* sprite, 
		ID3DXFont* font, 
		HWND wnd);
	MenuButton();
	~MenuButton();

	// renders the button to the screen
	void Render(void);

	// returns whether the cursor is over the graphic or not
	bool isMouseOver();

	// change the state of the button
	void Pressed(void)		{mIsPressed = true;};
	void Unpressed(void)	{mIsPressed = false;};

	// set the position of the button. Needed when we change screen format
	// and need to update the button with a new position relative to the top-left point
	// of the screen
	void UpdateSize(float bbWidth, float bbHeight);

	UINT GetID(void) {return idNum;};
};